package org.example;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.concurrent.TimeUnit;

/**
 * @author zhangjg
 * @desc c
 * @date 2023/04/25 09:13
 **/
public class ClientApp {

    private static final Logger logger = LoggerFactory.getLogger(ClientApp.class);

    public static void main(String[] args) {
        String url = args[0];
        int startIndex = Integer.parseInt(args[1]);
        int endIndex = Integer.parseInt(args[2]);
        for (int i = startIndex;i<=endIndex ; i++) {
            WebSocketClient wsClient = new WebSocketClient();
            try {
                wsClient.run(url+"?userName=user"+i);
//                wsClient.run(url+"/"+i);
//                TimeUnit.SECONDS.sleep(1);
                TimeUnit.MILLISECONDS.sleep(5);
            } catch (Exception e) {
                logger.error(e.getMessage(),e);
            }
        }

        try {
            TimeUnit.SECONDS.sleep(1000000);
        } catch (InterruptedException e) {
            logger.error(e.getMessage(),e);
        }

    }


}
